package com.we823.project.common.web;

import java.text.ParseException;
import java.util.Date;

import org.apache.commons.lang3.time.DateUtils;
import org.springframework.core.convert.converter.Converter;

public class CustomDateConverter implements Converter<String, Date>{

	@Override
	public Date convert(String source) {
		String[] format= {"yyyy-MM-dd HH:mm:ss","yyyy-MM-dd"};
		try {
			return DateUtils.parseDate(source, format);
		} catch (ParseException e) {
			e.printStackTrace();
		}
        return null;
	}
	
	

}
